package com.icepeach.icepeachhomeback.convert;


import com.icepeach.icepeachhomeback.entity.Menu;
import com.icepeach.icepeachhomeback.entity.Relation;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Taoyuanyuan
 * @create 2023/5/9 17:01
 */
@Mapper(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface RelationConvert {

    RelationConvert INSTANCE = Mappers.getMapper(RelationConvert.class);

    @Mappings({
            @Mapping(source = "businessId", target = "id"),
            @Mapping(source = "businessName", target = "name")
    })
    List<Menu> relationToMenuList(List<Relation> relations);
}
